package com.xinqi.modules.sys.stats.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xinqi.common.mybatis.data.repo.SuperMapper;
import com.xinqi.modules.sys.stats.domain.ClassTeachingDayStEntity;
import com.xinqi.modules.sys.stats.dto.req.ClassTeachingDayStQueryDTO;
import com.xinqi.modules.sys.stats.dto.req.ClassTeachingOverviewQueryDTO;
import com.xinqi.modules.sys.stats.dto.rsp.ClassOverviewResultDTO;
import com.xinqi.modules.sys.stats.dto.rsp.ClassTeachingCountResultDTO;
import com.xinqi.modules.sys.stats.dto.rsp.ClassTeachingDayStResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 班级教学数据统计数据层
 *
 * @author: wenjie
 * @date: 2023/08/24
 */
@Mapper
public interface ClassTeachingDayStMapper extends SuperMapper<ClassTeachingDayStEntity> {
    Page<ClassTeachingDayStResultDTO> findPage(Page<Object> page,
                                               @Param("schoolName") String schoolName,
                                               @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);

    List<ClassTeachingDayStResultDTO> findList(@Param("dto") ClassTeachingDayStQueryDTO query);

    List<ClassTeachingCountResultDTO> findCourseContentCountByTypeAndCourseClassIdListAndDateRange(@Param("type") Integer type, @Param("courseClassIdList") List<Long> courseClassIdList, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);

    List<ClassTeachingCountResultDTO> findCurrentDateReleaseHomeworkByTypeAndCourseClassIdListAndDateRange(@Param("type") Integer type, @Param("courseClassIdList") List<Long> courseClassIdList, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);

    ClassOverviewResultDTO overview(@Param("query") ClassTeachingOverviewQueryDTO query);

    IPage<ClassTeachingDayStEntity> findPageBySchoolNameList(Page<ClassTeachingDayStEntity> page, @Param("schoolNameList") List<String> schoolNameList);

    List<ClassTeachingCountResultDTO> findContentSortListAndDateRange(@Param("schoolName") String schoolName, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);
}
